class AddHashedPasswordToUsers < ActiveRecord::Migration
  def self.up
    add_column :users, :hashed_password, :string
    
    users = User.find_all
    users.each do |user|
      user.password = user["password"]
      user.hashed_password = User.hash_password(user.password)
      user.password_confirmation = user.password
      user.save
    end
  end

  def self.down
    remove_column :users, :hashed_password
  end
end
